"""
Copyright 2009, Thomas Dejanovic.

This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.

This is a very simple sanity test for the Digilent S3 board.
"""

s3board = Struct(name='s3board', target='small apb slave')

s3board.Register('button', bit_width=4, sw='r', external=True,
    comment="This is the bank of 4 buttons on the bottom left edge of the board.")

s3board.Register('switch', bit_width=8, sw='r', external=True,
    comment='This is the bank of 8 switches on the bottom right edge of the board.')

s3board.Register('led', bit_width=8, sw='rw', hw='r',
    comment="""This is the bank of 8 LEDs on the bottom left corner of the board.""")

cPack = s3board.Pack('cPack')
cPack.properties['comment'] = "This is the 4x7 segment display on the bottom right corner of the board."
cPack.properties['comment'] += "  Values are displayed in hex."

cPack.Register('c3', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c2', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c1', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c0', bit_width=4,  sw='rw', hw='ir')

s3board.Register('soft_reset', bit_width=1, sw='rw', hw='r', comment="Soft reset.")

hatchBlock = s3board    # Set s3board to hatch's default top node identifier (see hatch_constants.py).


